﻿Imports System.Data.OleDb

Public Class Add_a_Guide
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btn_submit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_submit.Click


        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("TravellingAloneConnectionString").ConnectionString)
        Dim SqlString As String = "Insert into guides(the_title, the_location, the_description) Values (@f1,@f2,@f3)"
        Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@f1", tb_title.Text)
        cmd.Parameters.AddWithValue("@f2", tb_location.Text)
        cmd.Parameters.AddWithValue("@f3", tb_description.Text)
        oleDbConn.Open()
        cmd.ExecuteNonQuery()
        Response.Redirect("Default.aspx")

    End Sub
End Class